<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        try
        {
            //Initialise String Resources
            string resourceCulture = ConfigurationManager.AppSettings.Get("GlobalEnvironmentLanguage");
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(resourceCulture);

            //initialize Media resources
            Ent.Web.Helper.MediaHelper.Init(ConfigurationManager.AppSettings.Get("Media"));

            //initialize DBConnection
            Ent.SqlDB.Connection.Set(ConfigurationManager.AppSettings.Get("ConnectionString"));

            //initialize Language
            ResourceHelper.Init();

            //initialize Mail
            Ent.Web.Mail.Collection.Init(ConfigurationManager.AppSettings.Get("AutoMail"));
            
            //initialize FAQHelper
            Ent.Web.Helper.FAQHelper.Init(ConfigurationManager.AppSettings.Get("FAQ"));
            
            //initialize Previledge
            Ent.Web.Helper.Priviledge.Init(ConfigurationManager.AppSettings.Get("Priviledge"));

            //initialize Content
            Ent.Web.Helper.ContentHelper.Init(ConfigurationManager.AppSettings.Get("Content"));

            Common.Log.Info("Application started.");            
        }
        catch (Exception exc)
        {
            Common.Log.Error(exc);
            throw exc;
        }
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        Common.Log.Info("Application end.");
    }
        
    void Application_Error(object sender, EventArgs e) 
    {
        Common.Log.Error("Application crashed with an error.");
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
